package com.ngc.mall.core.enumeration;

import java.util.stream.Stream;

/**
 *
 * 优惠券状态
 * @author: chenxiaolin
 * @date 2023/8/22 22:36
**/
public enum CouponStatus {
    AVAILABLE(1,"可以使用，未过期"),
    USED(2,"已使用"),
    EXPIRED(3,"已过期");

    private Integer value;

    CouponStatus(Integer value,String description){
        this.value=value;
    };

    public Integer getValue() {
        return value;
    }

    public static CouponStatus toType(int value){
        return Stream.of(CouponStatus.values())
                .filter(c->c.value==value)
                .findAny()
                .orElse(null);
    }
}
